package com.ds.lens.data.common.document;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;

import java.io.Serializable;

/**
 * Description:
 *
 * @author WeiShaoying
 * @date 2020-05-08
 */
@Data
@Document(indexName = "forecast_data", type = "forecast_data", createIndex = false)
public class ForecastData implements Serializable {
    private static final long serialVersionUID = -710357464846139904L;

    @Id
    private String id;
    private Long monitorId;
    private Integer version;
    private String subTopic;
    private Long ts;
    private Double forecastValue;
    private Double alertThresholdUpper;
    private Double alertThresholdLower;

    public Double getForecastValue() {
        if (Double.isNaN(this.forecastValue)) {
            return null;
        }
        return forecastValue;
    }

    public Double getAlertThresholdUpper() {
        if (Double.isNaN(this.alertThresholdUpper)) {
            return null;
        }
        return alertThresholdUpper;
    }

    public Double getAlertThresholdLower() {
        if (Double.isNaN(this.alertThresholdLower)) {
            return null;
        }
        return alertThresholdLower;
    }
}
